package com.lss.myapplication.db.dao;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;

import com.lss.myapplication.db.County;

import java.util.List;

@Dao
public interface CountyDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insert(County county);

    @Update
    void update(County county);

    @Delete
    void delete(County county);

    @Query("SELECT * FROM county WHERE id = :id")
    County getCountyById(int id);

    @Query("SELECT * FROM county")
    List<County> getAllCounties();

    @Query("SELECT * FROM county WHERE cityId = :id")
    List<County> getCountiesByCityId(int id);
}
